<template>
  <div :class="['lastplay',{'show':show}]">
    <div class="topbox">
      <div class="zuo" @click.stop="hidelastplay">
        <i class="iconfont icon-zuo"></i>
      </div>
      <div class="center">最近播放</div>
    </div>
    <div class="contentbox">
      <div class="minbox" v-for="(ele) in lastPlaylist" :key="ele.song.id">
        <div class="name van-ellipsis">{{ele.song.name}}</div>
        <div class="bottom">
          <div class="singername van-ellipsis">{{ele.song.ar[0].name}}</div>
          <div>&nbsp;-&nbsp;</div>
          <div class="songname van-ellipsis">{{ele.song.al.name}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { lastPlay } from "../assets/api/personal";
export default {
  props: ["show"],
  data() {
    return {
      lastPlaylist: [],
    };
  },
  methods: {
    hidelastplay() {
      this.$emit("hidelastplayson");
    },
  },

  created() {
    lastPlay().then((data) => {
      this.lastPlaylist = data.weekData;
    });
  },
};
</script>

<style lang="less">
.lastplay {
  width: 100%;
  height: 100%;
  position: fixed;
  left: 100%;
  top: 0;
  overflow-y: scroll;
  transition: all 0.3s ease-in-out;
  &.show {
    left: 0;
    &::before {
      left: 0;
    }
  }
  &::before {
    transition: all 0.3s ease-in-out;
    width: 100%;
    height: 100%;
    content: " ";
    z-index: -1;
    top: 0;
    left: 100%;
    position: fixed;
    filter: blur(1.5px);
    background: url(../assets/imgs/bg.jpg) rgba(0, 0, 0, 0.3) center 0 no-repeat;
    background-blend-mode: multiply;
    background-size: cover;
  }
  .topbox {
    display: flex;
    color: white;
    height: 60px;
    align-items: center;
    padding: 0 16px;
    background-color: rgba(255, 255, 255, 0.01);
    backdrop-filter: blur(20px);
    .zuo {
      flex: 0 0 24px;
      i {
        font-size: 24px;
      }
    }
    .center {
      flex: 1;
      font-size: 18px;
      text-align: center;
    }
  }
  .contentbox {
    padding: 0 16px;
    .minbox {
      margin-top: 26px;

      color: white;
      .name {
        font-size: 16px;
      }
      .bottom {
        margin-top: 8px;
        display: flex;
        font-size: 14px;
        color: rgba(255, 255, 255, 0.5);
      }
    }
  }
}
</style>